<?php
// +----------------------------------------------------------------------
// | Created by PhpStorm
// +----------------------------------------------------------------------
// | Date: 2020/6/23 14:27
// +----------------------------------------------------------------------
// | Use : 说明用途，主要方面！
// +----------------------------------------------------------------------
// | Author: Freedom <961449954@qq.com>
// +----------------------------------------------------------------------
namespace app\common\model\banner;

use app\common\model\TimeModel;

class Advert extends TimeModel{
    protected $deleteTime = 'delete_time';

    /**
     *类型获取器
     */
    public function getTypeAttr($value){
        $type= [
            1 => '机构',
            2 => '资讯',
            3 => '网上课程',
        ];
        return $type[$value];
    }
    /**
     *定义关联
     */
    public function user(){
        return $this->belongsTo('app\common\model\banner\Positions','position_id','id')->field('id,name');
    }
}